#include <iostream>
#include <vector>
#include <string>

using namespace std;

bool isUgly(int n) {
    if(n <= 0) return false;
    while(n != 1){
        int m = n;
        if(n%2 == 0){
            n /= 2;
        }
        if(n%3 == 0){
            n /= 3;
        }
        if(n%5 == 0){
            n /= 5;
        }
        if(m == n) return false;
    }
    return true;
}

int main(){
    int n = 6;
    cout << isUgly(n) << endl;
    return 0;
}
